package com.sanjiahantang.youjiaclient.module.category.models.impl;

import android.content.Context;
import android.os.Handler;
import android.util.Log;

import com.sanjiahantang.youjiaclient.base.BaseBean;
import com.sanjiahantang.youjiaclient.base.CallBack;
import com.sanjiahantang.youjiaclient.config.ConfigValue;
import com.sanjiahantang.youjiaclient.http.BaseDelegate;
import com.sanjiahantang.youjiaclient.http.OkHttpClientManager;
import com.sanjiahantang.youjiaclient.module.category.beans.CategoryBean;
import com.sanjiahantang.youjiaclient.module.category.models.ICategoryModel;
import com.squareup.okhttp.Request;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by zy on 2017/10/9.
 */

public class CategoryModel implements ICategoryModel {
    @Override
    public void loadLevel1(final Context context, Map<String, Object> params, final CallBack<CategoryBean> callBack) {
        OkHttpClientManager.postJson(context, ConfigValue.API_URL + "/mall/category/phone/searchCategoryForCustomerTree",
                params, new BaseDelegate.ResultCallback<CategoryBean>() {
                    @Override
                    public void onError(Request request, Object tag, Exception e) {
                        callBack.onFailure(e.getMessage());
                    }

                    @Override
                    public void onResponse(CategoryBean response, Object tag) {
                        callBack.onSuccess(response,context,tag);
                    }
                });
    }

    @Override
    public void loadLevel2(final Context context, Map<String, String> params, final CallBack<CategoryBean> callBack) {

    }
}
